package com.example.manu_facturer_orders.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.manu_facturer_orders.mapper.FacturerPaymentMapper;
import com.example.manu_facturer_orders.pojo.FacturerPaymentVO;
import com.example.manu_facturer_orders.service.FacturerPaymentService;
import commons.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: tobed
 * @date: 2022/9/14
 * @time: 16:11
 */
@Service
public class FacturerPaymentServiceImpl implements FacturerPaymentService {

    @Autowired
    FacturerPaymentMapper facturerPaymentMapper;

    /**
     * 厂商支付单全查
     * @param billDate
     * @param page
     * @return
     */
    @Override
    public Page<FacturerPaymentVO> listPayMent(String billDate,Integer billType,Integer billUserType, Page<FacturerPaymentVO> page) {
        String date = "";
        if (billDate.length()>0){
            date = billDate.substring(0, 10);
        }
        return facturerPaymentMapper.listPayMent(date,billType,billUserType,page);
    }

    /**
     * 下拉框日期全查
     * @return
     */
    @Override
    public Result listBillDate() {
        List<FacturerPaymentVO> list = facturerPaymentMapper.listBillDate();
        if (!list.isEmpty()){
            return Result.success(list);
        }else{
            return Result.error();
        }
    }
}
